package com.baturu.vin.gm.dal.entity;

import com.google.common.base.Splitter;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.FieldDefaults;
import org.apache.commons.lang3.StringUtils;

import java.util.Collections;
import java.util.List;

/**
 * @Author: chenjiahao
 * @Time: 2019/10/10
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class GMSelfRuleEntity {
    String btrPartsCode;

    String btrPartsName;

    String partsCode;

    public List<String> getPartsCodeList(){
        if (StringUtils.isBlank(partsCode)) {
            return Collections.emptyList();
        }
        return Splitter.on(",").splitToList(partsCode);
    }

}
